<?php
class VASProcessModules 
{
	// the keys are what are stored in the FH record's modules field
	public static $_modules = array(
   		"INTRO"=>array("Introduction","vasintroduction"),
   		"EXPECT"=>array("What to Expect","vaswhattoexpect"),
   		"LIFE"=>array("Celebration of Life","vascelebrationoflife"),
   		"CHOICES"=>array("Choices","vaschoices"),
		"BURIAL"=>array("Burial Tributes", "vasburial"),
		"CASKET"=>array("Burial Showroom", "vascasket"),
		"CREMATION"=>array("Cremation Tributes", "vascremation"),
		"URN"=>array("Cremation Showroom", "vasurn"),
		"MEMORIAL"=>array("Memorial Tribute", "vasmemorial"),
		"ALACARTE"=>array("Other Offerings", "vasalacarte"),
		"SERVICES"=>array("Services","vasservices"),
		"STEPSUMMARY"=>array("Step Summary", "vasstepsummary"),
		"MERCHANDISE"=>array("Merchandise","vasmementos"),
		"FLORAL"=>array("Floral","vasfloral"),
		"CATERING"=>array("Catering","vascatering"),
		"CASHADV"=>array("Cash Advances","vascashadvances"),		
		"FULLSUMMARY"=>array("Full Summary", "vasfullsummary"),
		"FIRSTCONTACT"=>array("First Contact", "vasfirstcontact"),
		"VITALS"=>array("Vitals","vasvitals"),
		"FINANCIALS"=>array("Securing Account","vasfinancials"),
		"CLOSING"=>array("Closing","vasclosing")
	);

	public static function getDefaultOrder()
	{
		$keys = array_keys( self::$_modules );
		return implode("|", $keys);
	}
	
	public static function nextModule( $currentModule, &$moduleOrderArray )
	{
		$nextModule = "";
		$numModules = count($moduleOrderArray);
		$idx = array_search( $currentModule, $moduleOrderArray );
		if($idx>=0)
		{
			$idx++;
			$nextModule = $moduleOrderArray[$idx];
		}
		
		return $nextModule;
	}
	
	public static function prevModule( $currentModule, &$moduleOrderArray )
	{
		$prevModule = "";
		$numModules = count($moduleOrderArray);
		$idx = array_search( $currentModule, $moduleOrderArray );
		if($idx>=0)
		{
			$idx--;
			$prevModule = $moduleOrderArray[$idx];
		}
		
		return $prevModule;
	}	
}
?>
